//
//  GZmainViewController.swift
//  iosswift
//
//  Created by apple on 15/11/23.
//  Copyright © 2015年 apple. All rights reserved.
//

import UIKit

class GZmainViewController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
        let tabb=GZtabbar()
        setValue(tabb, forKey: "tabBar")
        tabb.button.addTarget(self, action: "addclick", forControlEvents: UIControlEvents.TouchUpInside)
        tabBar.tintColor=UIColor.orangeColor()
        addcontroller("首页", imagename: "tabbar_home", controller: GZhomeTableViewController())
        addcontroller("消息", imagename: "tabbar_message_center", controller: GZmessageTableViewController())
        addcontroller("发现", imagename: "tabbar_discover", controller: GZdiscoverTableViewController())
        addcontroller("我", imagename: "tabbar_profile", controller: GZprofileTableViewController())
       
    }

    private func addcontroller(text:String,imagename:String,controller:UIViewController)
    {
        controller.title=text
        controller.tabBarItem.image=UIImage(named: imagename)
       self.addChildViewController(UINavigationController(rootViewController: controller))
    }
    func addclick()
    {
       
    }

}
